home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / st80_pr4.lha / st80_pre4 / Foible / foible / edit.makecode.st < prev    next >
Text File  |  1993-07-24  |  2KB  |  66 lines

  1. 'GraphicEditorsOpenCodeView.st: Form-code generation by formEditor and bitEditor
  2.  
  3. Description:
  4. This code adds an entry to the middle-mouse-button menu of both the bitEditor
  5. and the formEditor. Besides [accept] and [cancel] you can select [code], which
  6. will open a new window for you with Smalltalk code describing the current form
  7. you are editing. You can copy this code and manipulate it, e.g. <display>,
  8. <magnifyBy:>, etc.
  9.  
  10. This program is placed in the public domain. Neither I nor my company will
  11. recognize any responsibility for damages arising from use of this program.
  12.                                                  Pieter S. van der Meulen' !
  13.  
  14. !FormHolderView methodsFor: 'menu messages'!
  15.  
  16. openCodeView
  17.     "Open a window with a code description of the currently displayed form"
  18.  
  19.     | aStream |
  20.     aStream _ WriteStream on: (String new: 1000).
  21.     displayedForm storeOn: aStream base: 10.
  22.     StringHolderView open: (StringHolder new contents: aStream contents)
  23.         label: 'Displayed Form Code'! !
  24.  
  25. !BitEditor methodsFor: 'menu messages'!
  26.  
  27. openCodeView
  28.     "Open a window with a code description of the currently displayed form"
  29.  
  30.     view openCodeView! !
  31.  
  32. !BitEditor class methodsFor: 'class initialization'!
  33.  
  34. initialize
  35.     "BitEditor initialize."
  36.  
  37.     YellowButtonMenu _ PopUpMenu labels:
  38. 'accept
  39. cancel
  40. code'.
  41.     YellowButtonMessages _ #(accept cancel openCodeView)! !
  42.  
  43. !FormEditor methodsFor: 'menu messages'!
  44.  
  45. openCodeView
  46.     "Open a window with a code description of the currently displayed form"
  47.  
  48.     view updateDisplay.
  49.     view openCodeView! !
  50.  
  51. !FormEditor class methodsFor: 'class initialization'!
  52.  
  53. initialize
  54.     "FormEditor initialize."
  55.  
  56.     FlashCursor _ false.
  57.     self setKeyboardMap.
  58.     YellowButtonMenu _ PopUpMenu labels:
  59. 'accept
  60. cancel
  61. code'.
  62.     YellowButtonMessages _ #(accept cancel openCodeView)! !
  63.  
  64. BitEditor initialize.
  65. FormEditor initialize!
  66.